package org.finmanager.alert;

import com.alee.laf.optionpane.WebOptionPane;
import org.finmanager.budget.Budget;

import javax.swing.*;
import java.util.ArrayList;

/**
 * Created by Kelvin on 26/4/2014.
 */

// There is a "!" button on the right low corner, pressing that button will show a small window
// Inside this ALERT window, users will know is there any budgets are almost depleted
public class AlertUI {
	public AlertUI(JComponent component, ArrayList<Budget> budgets) {
		StringBuilder sb = new StringBuilder();
		if (budgets.size() > 0) {
			sb.append("The following budgets are almost depleted:\n");
			for (Budget budget : budgets) {
				sb.append("\n");
				sb.append(budget.getCategory().toString());
			}
		} else {
			sb.append("No special message.");
		}

		WebOptionPane.showMessageDialog(component, sb, "Alert", WebOptionPane.INFORMATION_MESSAGE);
	}
}
